package edu.ccut.saturn.studio.logic.model.saturn;
//package edu.ccut.saturn.studio.logic.model.saturn;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import org.eclipse.core.resources.IProject;
//import org.w3c.dom.Document;
//import org.w3c.dom.Element;
//import org.w3c.dom.Node;
//
//import edu.ccut.saturn.search.internal.SearchFile;
//import edu.ccut.saturn.studio.core.util.xml.SaturnW3CUtil;
//import edu.ccut.saturn.studio.logic.model.IVisit;
//import edu.ccut.saturn.studio.logic.model.Shape;
//import edu.ccut.saturn.studio.util.ConversionUtil;
//
//public class ActionDataSearch implements IVisit {
//	private SaturnDataNode saturnDataNode;
//
//	public void visit(Shape shape) {
//		this.saturnDataNode = (SaturnDataNode) shape;
//	}
//
//	public String[] searchInProject(IProject project) {
//
//		String[] suffixs = new String[] { "sqldata", "saturndata" };
//		List<Document> documents = new ArrayList<Document>();
//		documents = SearchFile.searchFileInproject(project, suffixs);
//		return getNameWithNamespace(documents);
//
//	}
//
//	public String[] searchInWorkspace() {
//		String[] suffixs = new String[] { "sqldata", "saturndata" };
//		List<Document> documents = new ArrayList<Document>();
//		documents = SearchFile.searchFileInWorkspace(suffixs);
//		return getNameWithNamespace(documents);
//
//	}
//
//	private String[] getNameWithNamespace(List<Document> documents) {
//
//		List<String> namespaces = new ArrayList<String>();
//		for (Document document : documents) {
//		Element root = document.getDocumentElement();
//		Node dataNode = root.getElementsByTagName("data").item(0);
//			String namespace = SaturnW3CUtil.getNodeAttributeValue(dataNode,
//					saturnDataNode.SHOW_DATA_NODE_DATA_NAMESPACE);
//			String name = SaturnW3CUtil.getNodeAttributeValue(dataNode,
//					saturnDataNode.SHOW_DATA_NODE_NAME);
//			namespaces.add(namespace + "::" + name);
//		}
//		return ConversionUtil.conversion(namespaces);
//	}
//}
